<!DOCTYPE html>
<html lang="en">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport"
		content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no" />
	<meta name="format-detection" content="telephone=no" />
	<meta name="format-detection" content="email=no" />
	<meta http-equiv="Pragma" content="no-cache" />
	<meta http-equiv="Cache-Control" content="no-cache" />
	<meta http-equiv="Expires" content="0" />
	<title>患者档案-基本信息</title>
	<!-- 引入 vant UI 组件库样式文件 -->
	<link rel="stylesheet" href="../../common/css/vant-index.css" />
	<style rel="stylesheet">
		body {
			background-color: #f7f8fa;
		}

		a {
			-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
		}

		a:-webkit-any-link {
			color: #eee;
		}

		.container {
			border: 1px solid #f5f5f5;
			box-shadow: -1px 5px 5px #ececec;
			border-radius: 10px;
			/* margin: 0.6rem; */
			padding: 0;
		}

		.van-cell-group--inset {
			margin: 0;
		}

		.tab-btn {
			margin: 0.2rem;
			height: 1.7rem;
			line-height: 1.7rem;
		}
	</style>
</head>

<body>
	<div id="app" v-cloak>
		<div class="container">
			<van-nav-bar title="基本信息" left-text="返回" left-arrow @click-left="onClickLeft" @click-right="onClickRight">
				<template #right>
					<van-icon name="wap-home-o" size="18" />
				</template>
			</van-nav-bar>
			<van-cell-group inset>
				<van-cell>
					<template #title>
						<span class="custom-title"> 姓名 </span>
					</template>
					<template #value>
						{{currentData.patientName}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title"> 性别 </span>
					</template>
					<template #value>
						{{currentData.patientSexText}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title"> 年龄 </span>
					</template>
					<template #value> {{currentData.age}} </template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title"> 身份证号 </span>
					</template>
					<template #value>
						{{currentData.patientIdCard}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title"> 简要病史 </span>
					</template>
					<template #value>
						{{ currentData.patientDesc }}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title"> 手机号码 </span>
					</template>
					<template #value>
						{{currentData.patientMobile}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title"> 职业 </span>
					</template>
					<template #value>
						{{currentData.occupationText}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title"> 文化程度 </span>
					</template>
					<template #value>
						{{currentData.educationText}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title"> 所属省份 </span>
					</template>
					<template #value>
						{{currentData.provinceId == null ? '--' : currentData.provinceText }}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title"> 所属地市 </span>
					</template>
					<template #value>
						{{currentData.cityId== null ? '--' : currentData.city }}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title"> 患者属性 </span>
					</template>
					<template #value>
						{{currentData.patientPropertyText}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title"> 医疗支付方式 </span>
					</template>
					<template #value>
						{{currentData.payModeText}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title"> 长期卧床 </span>
					</template>
					<template #value>
						{{currentData.isSickedText}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title"> 家属姓名 </span>
					</template>
					<template #value> {{currentData.familyName}} </template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title"> 与患者关系 </span>
					</template>
					<template #value>
						{{currentData.familyRelationText}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title"> 家属手机号 </span>
					</template>
					<template #value>
						{{currentData.familyMobile}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title"> 是否妊娠 </span>
					</template>
					<template #value>
						{{currentData.gestationText}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title"> 妊娠日期 </span>
					</template>
					<template #value>
						{{currentData.gestationDate}}
					</template>
				</van-cell>
			</van-cell-group>
		</div>
	</div>
</body>
<!-- 上线环境用 -->
<script src="../../common/js/vue.global.prod.js"></script>
<!-- 引入 UI 组件库 -->
<script src="../../common/js/vant.min.js"></script>
<!-- axios 接口调用 -->
<script src="../../common/js/axios.min.js"></script>
<script src="../../base.js"></script>

<script type="module">
	import {
		getAction,
		postAction,
		getUrl,
	} from "../../common/js/api/vue3-axios-utils.js";

	const PatientData = {
		data() {
			return {
				url: {
					getInfo: "/100/12/1001202",
					updateInfo: "/100/12/1001203",
				},
				currentData: {},
				patient_url: "../index.html?userid=",
			};
		},
		created() {
			this.getData().catch((error) => {
				console.log(error);
			});
		},
		methods: {
			async getData() {
				let patientId = localStorage.pid;

				this.patient_url = this.patient_url + patientId;

				let url = getUrl() + this.url.getInfo;

				const res = await postAction(url, {
					patientId: patientId,
				});

				if (res.data.success) {
					this.currentData = await res.data.result["0"];

					// 时间处理
					if (this.currentData.gestationDate != null)
						this.currentData.gestationDate =
							this.currentData.gestationDate.slice(0, 10);
				}
			},
			onClickLeft() {
				window.location.href = "../filesIndex.html";
			},
			onClickRight() {
				window.location.href =
					"../index.html?userid=" + localStorage.pid;
			},
		},
	};

	const app = Vue.createApp(PatientData);

	app.use(vant);

	// 通过 CDN 引入时不会自动注册 Lazyload 组件
	// 可以通过下面的方式手动注册
	app.use(vant.Lazyload);

	// 调用函数组件，弹出一个 Toast
	// vant.Toast("刷新成功");

	app.mount("#app");
</script>

</html>